package cn.edu.xmu.oomall.payment.model.vo;

import cn.edu.xmu.oomall.payment.model.bo.Refund;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * @author 张浩山
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ShopRefundDetailRetVo {
    @ApiModelProperty(value = "id")
    private Long id;
    @ApiModelProperty(value = "支付交易流水号")
    private String tradeSn;
    @ApiModelProperty(value = "支付渠道")
    private Long patternId;
    @ApiModelProperty(value = "支付id")
    private Long paymentId;
    @ApiModelProperty(value = "支付金额")
    private Long amount;
    @ApiModelProperty(value = "状态")
    private Byte state;
    @ApiModelProperty(value = "单据号")
    private String documentId;
    @ApiModelProperty(value = "单据类型")
    private Byte documentType;
    @ApiModelProperty(value = "备注")
    private String descr;
    @ApiModelProperty(value = "调账人")
    private SimpleUserRetVo adjust;
    @ApiModelProperty(value = "调账时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern ="yyyy-MM-dd'T'HH:mm:ss.SSS" ,timezone = "GMT+8")
    private LocalDateTime adjustTime;
    @ApiModelProperty(value = "创建人")
    private SimpleUserRetVo creator;
    @ApiModelProperty(value = "修改人")
    private SimpleUserRetVo modifier;
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern ="yyyy-MM-dd'T'HH:mm:ss.SSS" ,timezone = "GMT+8")
    private LocalDateTime gmtCreate;
    @ApiModelProperty(value = "修改时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern ="yyyy-MM-dd'T'HH:mm:ss.SSS" ,timezone = "GMT+8")
    private LocalDateTime gmtModified;

    public ShopRefundDetailRetVo(Refund refund) {
        id = refund.getId();
        tradeSn = refund.getTradeSn();
        patternId = refund.getPatternId();
        paymentId = refund.getPaymentId();
        amount = refund.getAmount();
        state = refund.getState();
        documentId = refund.getDocumentId();
        documentType = refund.getDocumentType();
        descr = refund.getDescr();
        adjust = new SimpleUserRetVo(refund.getAdjustId(), refund.getAdjustName());
        adjustTime = refund.getAdjustTime();
        creator = new SimpleUserRetVo(refund.getCreatorId(), refund.getCreatorName());
        gmtCreate = refund.getGmtCreate();
        gmtModified = refund.getGmtModified();
    }
}
